
<template>
  <div>
    <home-header v-bind:city="city" />
    <home-swiper :list="listSwiper" />
    <home-icons :list="listIoncs" />
    <home-recommend :list="listRecommend" />
    <home-weekend :list="listWeekend" />
  </div>
</template>

<script>
import HomeHeader from './components/Header'
import HomeSwiper from './components/Swiper'
import HomeIcons from './components/Icons'
import HomeRecommend from './components/Recommend'
import HomeWeekend from './components/Weekend.vue'
import axios from 'axios'
export default {
  name :'Home',
  data(){
    return{
      city:'',
      listSwiper:[],
      listRecommend:[],
      listWeekend:[],
      listIoncs:[]
    }
  },
  components:{
    HomeHeader,HomeSwiper,HomeIcons,HomeRecommend,HomeWeekend
  },
  methods:{
    getHomeInfo(){
      axios.get('/I/index.json')
      .then(this.getHomeInfoSuccess)
    },
    getHomeInfoSuccess(res){
      //console.log(res);
      res = res.data
      if(res.ret&&res.data){
        const data = res.data;
        this.city = data.city;
        this.listSwiper = data.swiperList;
        this.listRecommend = data.recommendList;
        this.listWeekend = data.weekendList;
        this.listIoncs = data.iconList;
      }
    }
  },
  mounted(){
    this.getHomeInfo()
  }
}
</script>

